fix: make Ask output token budget configurable - #1247
Open
bferanmi806-sketch wants to merge 3 commits into
Open
Conversation
bferanmi806-sketch
marked this pull request as ready for review
August 6, 2026 11:14
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Make the Ask/Q&A output token budget configurable across the strategy, intermediate-answer, and final-answer model-generation stages so reasoning models have sufficient budget before thinking content is removed.
Structured strategy generation, intermediate answers, and final answers all use
OPEN_NOTEBOOK_ASK_MAX_TOKENS.The default is
8192tokens.Malformed, zero, and negative values safely fall back to
8192with a warning.Added focused regression tests and configuration documentation.
No API, frontend, provider, dependency, or database behavior changed.
Related Issue
Fixes #1221
Type of Change
How Has This Been Tested?
uv run pytest)Test Details:
uv sync- completed successfully.uv run pytest tests/test_ask_token_budget.py -v- 9 passed, 1 dependency deprecation warning.uv run pytest tests/ -q- 612 passed, 3 failed, 49 errors, 2 dependency warnings. The same three Windows path/proxy-environment failures and 49 temp-directory/Windows-permission errors documented for this PR remain; no Ask-related tests failed.uv run ruff check .- passed.uv run ruff format --check open_notebook/graphs/ask.py tests/test_ask_token_budget.py- 2 files already formatted.uv run python -m mypy .- no issues found in 131 source files.git diff --check- passed.Design Alignment
Which design principles does this PR support? (See VISION.md)
Explanation:
The change adds one narrow, process-level configuration helper instead of expanding the request/API contract. It preserves provider-agnostic model selection and passes the budget through the existing per-call Esperanto configuration path.
Checklist
Code Quality
Testing
make rufforruff check . --fixmake lintoruv run python -m mypy .Documentation
/docs(if applicable)Database Changes
Breaking Changes
Screenshots (if applicable)
Not applicable; this is a backend-only change.
Additional Context
All three Ask model-generation stages use the same cached
OPEN_NOTEBOOK_ASK_MAX_TOKENSvalue: structured strategy generation, fan-out intermediate answers, and final-answer synthesis. The existing structured JSON response format and model-selection behavior remain unchanged.Pre-Submission Verification
Before submitting, please verify:
bferanmi806-sketchfix: make Ask output token budget configurableThank you for contributing to Open Notebook!